<template>
  <el-container>
    <el-header
        style="background-color: #336688;line-height: 60px">
      <h1 style="font-size: 30px;margin: 0;color: white">烘焙坊后台管理系统
      <span style=" float: right;font-size: 20px">欢迎{{user.nickname}}回来!
          <a href="javascript:void(0)" @click="logout()" style="color: orange;text-decoration: none">退出登录</a>
      </span>
      </h1>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu active-text-color="orange" router>
          <img src="/imgs/icon.png" width="150px">
          <el-divider></el-divider>
          <el-menu-item index="/admin/index">
            <i class="el-icon-user">用户管理</i>
          </el-menu-item>
          <el-menu-item index="/admin/banner">
            <i class="el-icon-picture">轮播图管理</i>
          </el-menu-item>
          <el-menu-item index="/admin/content">
            <i class="el-icon-info">内容管理</i>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "AdminView",
  data() {
    return {
      user: localStorage.user?JSON.parse(localStorage.user):null
    }
  },
  methods: {
    logout() {
      if (confirm("您确认退出登录吗?")){
        this.$router.replace("/index");
        localStorage.clear();//清空记录的登录信息
      }
    }
  },
}
</script>

<style scoped>

</style>